<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>

    <style>
        div {
            background: linear-gradient(90deg, #ffc700)
        }
    </style>
</head>

<body>
    <h1>渐变色动画</h1>
    <style>
        .test1 {
            background: linear-gradient(90deg, #ffc700 0%, #e91e1e 50%, #6f27b0 100%);
            background-size: 200% 100%;
            background-position: 0 0;
            animation: bgposition 2s infinite linear alternate;
        }


        @keyframes bgposition {
            0% {
                background-position: 0 0;
            }

            100% {
                background-position: 100% 0;
            }
        }
    </style>
    <div class="test1" style="height: 200px;">
    </div>
</body>

</html>